<template>
  <el-table
    :data="gridsData"
    highlight-current-row
    @row-click="handleCurrentChange"
    border
    style="width: 100%"
  >
    <el-table-column type="index" label="序号" align="center" width="50"></el-table-column>
    <el-table-column prop="Name" align="center" label="产品名称"></el-table-column>
    <el-table-column prop="OrderProductCode" align="center" label="产品编码"></el-table-column>
    <el-table-column prop="BoardGridId" align="center" label="储位编号" width="77"></el-table-column>
  </el-table>
</template>

  <script>
import { commitTechOrderProductByTechType } from "@/api/output";
export default {
  props: {
    gridsData: {
      type: Array
    }
  },
  data() {
    return {
      currentRow: ''
    };
  },
  methods: {
    handleCurrentChange(val) {

      this.$confirm('是否过站?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
      }).then(() => {
        this.currentRow = val;
        commitTechOrderProductByTechType({
          techType: 6,
          productCode: this.currentRow.OrderProductCode,
          isPass: true
        }).then(res => {
          if (parseInt(res.Code) === 1) {
            this.$message({
              type: "success",
              message: "过站成功"
            });
          }
          this.$parent.init()
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消过站'
        });          
      });
    }
  }
};
</script>